<template>
 <div style="width: 100%;line-height: 45px;padding: 0 20px;border-radius: 5px;backdrop-filter: blur(20px);" :style="{backgroundColor:userInfo==undefined?'rgba(255,230,230,0.6)':'rgba(242,242,242,0.6)'}">
  <div v-if="userInfo!=undefined">
    <span style="width: calc(100% / 5);display: inline-block;">
        考生信息
    </span>
    <span style="width: calc(100% / 5);display: inline-block;">
        姓名：{{ userInfo.name }}
    </span>
    <span style="width: calc(100% / 5);display: inline-block;">
        分数：{{ userInfo.score }}
    </span>
    <span style="width: calc(100% / 5);display: inline-block;">
        位次：{{ userInfo.ranking }}
    </span>
    <!-- <span style="width: calc(100% / 6);display: inline-block;">
        省份：{{ userInfo.province }}
    </span> -->
    <span style="width: calc(100% / 5);display: inline-block;">
        科目：{{ getSubjectString() }}
    </span>
  </div>
    <div v-if="userInfo==undefined" style="text-align: center;">
      <span><icon-info-circle /></span><span style="margin-left: 5px;">请先登录以使用查询功能和填报志愿</span><span><a-button type="primary" style="margin-left: 10px;" @click="changePageToLoginPage">登录</a-button></span>
    </div>
 </div>
</template>

<script>
import router from '@/utils/router';


export default{
  data(){
    return{
      
    }
  },
  mounted(){

  },
  methods:{
    changePageToLoginPage(){
      router.push('/login');
    },
    getSubjectString(){
      if(this.userInfo.subjects.slice(0,1)=='1'){
                let re = '';
                for(let i=1;i<=3;i++){
                  if(i!=1){
                    re+='、'
                  }
                  switch (this.userInfo.subjects.slice(i,i+1)) {
                    case '1':
                      re+='物理';
                      break;
                    case '2':
                      re+='化学';
                      break;
                    case '3':
                      re+='生物';
                      break;
                    case '4':
                      re+='政治';
                      break;
                    case '5':
                      re+='历史';
                      break;
                    case '6':
                      re+='地理';
                      break;
                  }
                }
                return re;
      }
      if(this.userInfo.subjects.slice(0,1)=='2'){
                let re = '';
                for(let i=1;i<=3;i++){
                  if(i!=1){
                    re+='、'
                  }
                  switch (this.userInfo.subjects.slice(i,i+1)) {
                    case '1':
                      re+='化学';
                      break;
                    case '2':
                      re+='生物';
                      break;
                    case '3':
                      re+='政治';
                      break;
                    case '4':
                      re+='地理';
                      break;
                    case '5':
                      re+='物理';
                      break;
                    case '6':
                      re+='历史';
                      break;
                  }
                }
                return re;
      }
      if(this.userInfo.subjects.slice(0,1)=='3'){
        return this.userInfo.subjects.slice(1,2)=='1'?'理科':'文科';
      }
    }
  },
  props:{
    userInfo:{
        type:Object
    }
  },
}
</script>

<style scoped>

</style>